package cn.com.nes.site.action.appanalysis;

import java.sql.SQLException;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import cn.com.nes.common.util.DBUtils;
import cn.com.nes.site.entity.DataReq;
import cn.com.nes.site.entity.DataRes;
import cn.com.nes.site.entity.PageData;
import cn.com.nes.site.module.service.analysis.AppAnalysisService;
import cn.com.nes.site.module.service.crm.AnalysisService;

@Controller("appanalysis")
@RequestMapping("/appanalysis")
public class AppAnalysisAction  {
	@Resource
	private AppAnalysisService appservice ;

	@RequestMapping(method = {RequestMethod.POST}, value = "/getAppHomeData")
	public @ResponseBody PageData getAppHomeData(HttpServletRequest request, HttpServletResponse response) throws SQLException {
		DataRes req_Status = DBUtils.setRemoteVisit(request, response,true);
		PageData res = new PageData() ;
		if (req_Status.getRetCode() != 0) {
            res = new PageData();
            res.setRetCode(req_Status.getRetCode()) ;
            res.setRetMessage(req_Status.getRetMessage());
            return res;
        }
		DataReq req = req_Status.getReq();
        res = appservice.getAppHomeData(req) ;
        return res;
	}
	
	@RequestMapping(method = {RequestMethod.POST}, value = "/getOpeMapData")
	public @ResponseBody PageData getOpeMapData(HttpServletRequest request, HttpServletResponse response) throws SQLException {
		DataRes req_Status = DBUtils.setRemoteVisit(request, response,true);
		PageData res = new PageData() ;
		if (req_Status.getRetCode() != 0) {
            res = new PageData();
            res.setRetCode(req_Status.getRetCode()) ;
            res.setRetMessage(req_Status.getRetMessage());
            return res;
        }
		DataReq req = req_Status.getReq();
        res = appservice.getOpeMapData(req) ;
        return res;
	}
	
	@RequestMapping(method = {RequestMethod.POST}, value = "/getNewParameters")
	public @ResponseBody PageData getNewParameters(HttpServletRequest request, HttpServletResponse response) throws SQLException {
		DataRes req_Status = DBUtils.setRemoteVisit(request, response,true);
		PageData res = new PageData() ;
		if (req_Status.getRetCode() != 0) {
            res = new PageData();
            res.setRetCode(req_Status.getRetCode()) ;
            res.setRetMessage(req_Status.getRetMessage());
            return res;
        }
		DataReq req = req_Status.getReq();
        res = appservice.getNewParameters(req) ;
        return res;
	}
	
	
}
